function Bear_Swipe(Unit)
    Unit:CastSpell(20605)
end

function Bear_Maul(Unit)
    Unit:CastSpell(26996)
end

function Bear_Stun(Unit)
    Unit:CastSpell(31755)
end

function Bear_Rage(Unit)
    Unit:CastSpell(24378)
end

function Bear_Final(Unit)
    Unit:CastSpell(14204)
    Unit:CastSpell(26478)
end

function Bear_Phase1(Unit, event)
    if Unit:GetHealthPct() < 90 then
        Unit:RemoveEvents()
        Unit:SendChatMessage(12, 0, "How dare you challenge me!")
        Unit:SetModel(762)
        Unit:SetScale(4)
        Unit:CastSpell(41232)
        Unit:RegisterEvent("Bear_Swipe",7500, 0)
        Unit:RegisterEvent("Bear_Phase2",1000, 0)
    end
end

function Bear_Phase2(Unit, event)
    if Unit:GetHealthPct() < 77 then
        Unit:RemoveEvents()
        Unit:SetModel(21631)
        Unit:SetScale(1.5)
        Unit:CastSpell(41232)
        Unit:RegisterEvent("Bear_Maul",8000, 0)
        Unit:RegisterEvent("Bear_Phase3",1000, 0)
    end
end


function Bear_Phase3(Unit, event)
    if Unit:GetHealthPct() < 60 then
        Unit:RemoveEvents()
        Unit:SendChatMessage(14, 0, "Time to DIE!")
        Unit:SetModel(21633)
        Unit:SetScale(2)
        Unit:CastSpell(41232)
        Unit:RegisterEvent("Bear_Stun",7500, 0)
        Unit:RegisterEvent("Bear_Phase4",1000, 0)
    end
end

function Bear_Phase4(Unit, event)
    if Unit:GetHealthPct() <= 37 then
        Unit:RemoveEvents()
        Unit:SetScale(2.5)
        Unit:SetModel(21633)
        Unit:CastSpell(41232)
        Unit:SendChatMessage(14, 0, "RAAAAWWWWWRRRRR!!!")
        Unit:RegisterEvent("Bear_Rage",8000, 0)
        Unit:RegisterEvent("Bear_Phase5", 1000, 0)
    end
end


function Bear_Phase5(Unit, event)
    if Unit:GetHealthPct() <= 20 then
        Unit:RemoveEvents()
        Unit:SendChatMessage(14, 0, "Nature's fury shall consume you!")
        Unit:SetScale(3)
        Unit:CastSpell(41232)
        Unit:RegisterEvent("Bear_Final",7000, 0)
    end
end

function Bear_OnCombat(Unit, event)
    Unit:SendChatMessage(12, 0, "Grrrr... You have awaken me from my slumber!")
    Unit:RegisterEvent("Bear_Phase1",1000, 0)
    Unit:RegisterEvent("Bear_Phase2",1000, 0)
    Unit:RegisterEvent("Bear_Phase3",1000, 0)
    Unit:RegisterEvent("Bear_Phase4",1000, 0)
    Unit:RegisterEvent("Bear_Phase5",1000, 0)
end


function Bear_OnLeaveCombat(Unit, event)
    Unit:RemoveEvents()
    Unit:SendChatMessage(12, 0, "MUUUAAAAHAHAHAHAHAHAHAHA!")
    Unit:SetScale(1)
    Unit:SetModel(21631)
end


function Bear_OnKilledTarget(Unit)
    Unit:SendChatMessage(12, 0, "Let that be a lesson!")
    Unit:CastSpell(36981)
end


function Bear_Death(Unit)
    Unit:SendChatMessage(14, 0, "Ohh... this is.. the wrong way to... die...")
    Unit:RemoveEvents()
    Unit:SetScale(1)
    Unit:SetModel(21631)
end

RegisterUnitEvent(22917, 1, "Bear_OnCombat")
RegisterUnitEvent(22917, 2, "Bear_OnLeaveCombat")
RegisterUnitEvent(22917, 3, "Bear_OnKilledTarget")
RegisterUnitEvent(22917, 4, "Bear_Death")